# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=sz
pkgver=2.1.12.5
pkgrel=3
pkgdesc="Modular parametrizable lossy compressor framework for scientific data"
arch=(loong64 x86_64)
url="https://szcompressor.org/"
license=(BSD)
depends=(glibc gcc-libs)
makedepends=(cmake gcc-fortran hdf5 netcdf python python-numpy swig)
source=(https://github.com/szcompressor/SZ/releases/download/v${pkgver}/sz-${pkgver}.tar.gz)
sha256sums=('32a820daf6019156a777300389d2392e4498a5c9daffce7be754cd0a5ba8729c')

build() {
  cmake -B build -S SZ-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_SKIP_RPATH=ON \
    -DBUILD_FORTRAN=ON \
    -DBUILD_HDF5_FILTER=ON \
    -DBUILD_NETCDF_READER=ON \
    -DBUILD_OPENMP=ON \
    -DBUILD_PYTHON_WRAPPER=ON \
    -DBUILD_SZ_EXAMPLES=ON
  make -C build
}

package() {
  make -C build DESTDIR="${pkgdir}" install
  install -Dm644 SZ-${pkgver}/copyright-and-BSD-license.txt -t "${pkgdir}"/usr/share/licenses/${pkgname}
  rm "${pkgdir}"/usr/bin/test*
}
